<%@page import="java.util.List"%>
<%@page import="com.wanmait.cookbook.vo.Province"%>
<%@page import="com.wanmait.cookbook.vo.Userinfo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
String path = request.getContextPath();
%>
<!DOCTYPE html>

<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <title>修改我的密码-南瓜美食</title>
    <link rel="icon" href="https://cp1.douguo.com/static/nweb/images/favicon.ico?v=1912" type="image/x-icon">
    <link rel="stylesheet" href="<%=path %>/static/css/main.css">
            <link rel="stylesheet" href="<%=path %>/static/css/setting.css">
        <script src="<%=path %>/static/js/osd.js.下载"></script><script src="./static/f.txt" id="google_shimpl"></script><script src="./static/js/hm.js.下载"></script><script src="./static/js/jquery.js.下载"></script>
    <script data-ad-client="ca-pub-6608973961595981" async="" src="./static/f(1).txt" data-checked-head="true"></script>
    
<link rel="preload" href="./static/f(2).txt" as="script"><script type="text/javascript" src="./static/f(2).txt"></script></head>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/js/jquery-3.5.1.min.js"></script>
<style type="text/css">
#table {
width:355px;
 	border:1px;
cellspacing:0;
cellpadding:1;
 	bordercolor:#cccccc;
height:35px;

}
#strength {
background-color:#ffffff;

}
</style>
<body>

<jsp:include page="/inc/head.jsp"></jsp:include>
<ins class="adsbygoogle adsbygoogle-noablate" data-adsbygoogle-status="done" style="display: none !important;"><ins id="aswift_0_expand" style="display:inline-table;border:none;height:0px;margin:0;padding:0;position:relative;visibility:visible;width:0px;background-color:transparent;"><ins id="aswift_0_anchor" style="display:block;border:none;height:0px;margin:0;padding:0;position:relative;visibility:visible;width:0px;background-color:transparent;"><iframe id="aswift_0" name="aswift_0" style="left:0;position:absolute;top:0;border:0;width:undefinedpx;height:undefinedpx;" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" frameborder="0" src="./static/ads.html" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" data-google-container-id="a!0" data-load-complete="true"></iframe></ins></ins></ins><script>
</script>
<%	

Userinfo userinfo = (Userinfo)session.getAttribute("userinfo");
%>
<div id="content" class="clearfix">
<form id="userinfo" method="post"  enctype="multipart/form-data" action ="<%=path %>/UserInfoServlet?action=updatePassword&id=<%=userinfo.getId()%>">
    <div id="left">
         <div class="type-tab">
<div class="type-head clearfix">
    <a href="" class="active">修改密码</a>

    
</div>
</div>
    
            <input type="hidden" name="userHead" value="">

            <label for="email">
                            </label>
            <label for="nickname">
                <span>原 密 码 ： </span> <input type="password" placeholder="请输入原密码" id="oidPassword" name="oidPassword" value="">
                <span style="color:red" id="oidspan"></span>
            </label>
             <label for="email">
                            </label>
            <label for="nickname">
                <span>新 密 码 ： </span> <input type="password"  placeholder="请输入密码" value="" id="newPassword" name="password" onKeyUp=pwStrength(this.value) onBlur=pwStrength(this.value)>
   
                <span style="color:red" id="newspan"></span>
                 	
            </label>

<table  id="table">
<tr align="center" bgcolor="#eeeeee">
<td width="25%" id="strength"><span>密码强度：</span></td>
<td width="25%" id="strength_L">弱</td>
<td width="25%" id="strength_M">中</td>
<td width="25%" id="strength_H">强</td>
</tr>
</table>
  <label for="email">
                            </label>
            <label for="nickname">
                <span>确认密码：</span> <input type="password" id="okPassword" placeholder="请再次输入" name="okPassword" value="">
                <span style="color:red" id="okspan"></span>
            </label>
<div style="height:200px;"></div>
 <input type="hidden" name="_token" value="XJm8NIr9iQCC6AGzQDtwakqpnbZFS3MUFh73gVXs">
            <a href="javascript:void(0)" class="save" id="save">保存</a>
        	<span id="savespan"></span>	
    </div>
    
</form>
</div>
<jsp:include page="/inc/foot.jsp"></jsp:include>
<script type="text/javascript">
var oidPassword = "<%=userinfo.getPassword()%>";
$("#save").click(function(){

var oidPasswords = $("#oidPassword").val();
var newPassword = $("#newPassword").val();
var okPassword = $("#okPassword").val();
var format = /^\w{6,15}$/;

var flag = format.test(newPassword);

if(oidPassword!=oidPasswords){
$("#oidspan").html("原密码错误！");
return;
}else{
$("#oidspan").html("");
}
if(!flag){
$("#newspan").html("密码为6-15位合法字符");
return;
}else{
$("#newspan").html("");
}	
if(newPassword!=okPassword){
$("#okspan").html("两次密码不一致");
return;
}else{
$("#okspan").html("");
}

$("#userinfo").submit();
});	
</script>
<script>
//CharMode函数
//测试某个字符是属于哪一类.
function CharMode(iN){
if (iN>=48 && iN <=57) //数字
return 1;
if (iN>=65 && iN <=90) //大写字母
return 2;
if (iN>=97 && iN <=122) //小写
return 4;
else
return 8; //特殊字符
}
//bitTotal函数
//计算出当前密码当中一共有多少种模式
function bitTotal(num){
modes=0;
for (i=0;i<4;i++){
if (num & 1) modes++;
num>>>=1;
}
return modes;
}
//checkStrong函数
//返回密码的强度级别
function checkStrong(sPW){
if (sPW.length<=4)
return 0; //密码太短
Modes=0;
for (i=0;i<sPW.length;i++){
//测试每一个字符的类别并统计一共有多少种模式.
Modes|=CharMode(sPW.charCodeAt(i));
}
return bitTotal(Modes);
}
//pwStrength函数
//当用户放开键盘或密码输入框失去焦点时,根据不同的级别显示不同的颜色
function pwStrength(pwd){
O_color="#eeeeee";
L_color="#FF0000";
M_color="#FF9900";
H_color="#33CC00";
if (pwd==null||pwd==''){
Lcolor=Mcolor=Hcolor=O_color;
}
else{
S_level=checkStrong(pwd);
switch(S_level) {
case 0:
Lcolor=Mcolor=Hcolor=O_color;
case 1:
Lcolor=L_color;
Mcolor=Hcolor=O_color;
break;
case 2:
Lcolor=Mcolor=M_color;
Hcolor=O_color;
break;
default:
Lcolor=Mcolor=Hcolor=H_color;
}
}
document.getElementById("strength_L").style.background=Lcolor;
document.getElementById("strength_M").style.background=Mcolor;
document.getElementById("strength_H").style.background=Hcolor;
return;
}
</script>

            <script src="./static/js/ajaxfileupload.js.下载"></script>
    <script src="./static/js/tip.js.下载"></script>
<script src="./static/js/search.js.下载"></script>
<script src="./static/js/main.js.下载"></script>
<!-- <script src='https://s13.cnzz.com/c.php?id=30029854' language='JavaScript' charset='gb2312'></script> -->
<script src="<%=request.getContextPath() %>/static/js/jquery-3.5.1.min.js" type="text/javascript"></script>


<iframe id="google_osd_static_frame_424902095950" name="google_osd_static_frame" style="display: none; width: 0px; height: 0px;" src="./static/saved_resource.html"></iframe></body><iframe id="google_esf" name="google_esf" src="./static/zrt_lookup.html" data-ad-client="ca-pub-6608973961595981" style="display: none;"></iframe></html>